<script lang="ts">
import { RouterLink, useLink,useRouter } from 'vue-router'

export default {
  name: 'AppLink',

  props: {
    // 如果使用 TypeScript，请添加 @ts-ignore
    ...RouterLink.props,
    inactiveClass: String,
  },

  setup(props) {

    console.log("RouterLink",RouterLink);
    console.log("RouterLink.props",RouterLink.props);

    const linkObj = useLink(props)

    // const isExternalLink = computed(
    //   () => typeof props.to === 'string' && props.to.startsWith('http')
    // )

    console.log("linkObj",linkObj);
    
    const $router = useRouter();

    const goUrl=()=>{
        // linkObj.navigate(linkObj.route.value.path);
        console.log("goUrl");
        
        $router.push(linkObj.route.value.path);
    }

    return { ...linkObj,goUrl }
  },
}

</script>

<template>
    <h1>子组件，</h1>
    <input type="button" value="去轮播图" @click="goUrl">
</template>

<style scoped>
    
</style>
